﻿using Dlls;
using Persistencia.Tabelas;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace UI.Views.Cadastros
{
    /// <summary>
    /// Interaction logic for frmCadastroServicos.xaml
    /// </summary>
    public partial class frmCadastroServicos : Window
    {
        private ServicosTable servicos;
        private ServicoDLL servicoDll;
        public frmCadastroServicos()
        {
            InitializeComponent();
            servicos = new ServicosTable();
            servicoDll = new ServicoDLL();
        }

        private void InsertOrUpdate(object sender, RoutedEventArgs e)
        {
            try
            {

            if (txtCodigo.Text =="")
            {
    
                servicos.Nome = txtServico.Text;
                servicos.Valor = decimal.Parse(txtValor.Text);               

              //  servicoDll.Insert(servicos);
                MessageBox.Show("Servico Cadastrado");
            }
            else
            {
                servicos.Nome = txtServico.Text;
            }

            }
            catch (Exception)
            {

                MessageBox.Show("Registro não pode ser gravado , favor verificar o correto preenchimento dos campos");
            }
            
        }
    }
}
